<?php
/* * **************************************************************************************\
 * *   @name		EXP Templates 1.0                                               **
 * *   @package          Joomla 1.6/1.7/2.5                                              **
 * *   @author		EXP TEAM::Alexey Kurguz (Grusha)                                **
 * *   @copyright	Copyright (C) 2005 - 2012  EXP TEAM::Alexey Kurguz (Grusha)     **
 * *   @link             http://www.feellove.eu                                          **
 * *   @license		Commercial License                                              **
  \*************************************************************************************** */
// No direct access.
defined('_JEXEC') or die;

$doc = JFactory::getDocument();

include_once(JPATH_ROOT . "/templates/" . $this->template . '/expcode/code.php');
JHtml::_('behavior.framework', true);

// get params
$logo = $this->params->get('logo');
$footerlogo = $this->params->get('footerlogo');
$expwell = $this->params->get('expwell');
/* * *** Grid System **** */
if ($this->params->get('gsystem')) {
    $gsystem = $this->params->get('gsystem');
} else {
    $gsystem = '';
}
/* * *** End Grid System **** */
if ($this->params->get('bootstrap')) {
    $bootstrap = $this->params->get('bootstrap');
} else {
    $bootstrap = 'bootstrap.css';
}
if ($this->params->get('expbootstrap')) {
    $expbootstrap = $this->params->get('expbootstrap');
} else {
    $expbootstrap = 'expbootstrap.css';
}
$app = JFactory::getApplication();
$templateparams = $app->getTemplate(true)->params;

$expcontent_l = 0;
$expcontent_r = 0;
$left_span = $this->params->get('expleft');
$right_span = $this->params->get('expright');
if ($this->countModules('left')) {
    $expcontent_l = $left_span;
}
if ($this->countModules('right')) {
    $expcontent_r = $right_span;
}
$expcontent = 12 - $expcontent_l - $expcontent_r;

$span_content_all = exptemplate_middle_spancount($this, $expcontent, 'content-a', 'content-b', 'content-c');
$span_feature_all = exptemplate_middle_spancount($this, $expcontent, 'feature-a', 'feature-b', 'feature-c');

$span_header = exptemplate_spancount($this, 12, 'header-a', 'header-b', 'header-c');
$span_middle = exptemplate_spancount($this, 12, 'middle-a', 'middle-b', 'middle-c');
$span_content = exptemplate_spancount($this, $span_content_all, 'content-a', 'content-b', 'content-c');
$span_feature = exptemplate_spancount($this, $span_feature_all, 'feature-a', 'feature-b', 'feature-c');
$span_bottom = exptemplate_spancount($this, 12, 'bottom-a', 'bottom-b', 'bottom-c', 'bottom-d');
$expnavbar = null;
if($this->params->get('topnav',1)){
    $expnavbar = ' navbar-fixed-top';
}
//print_r($span_feature_all."<br />");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
    <head>
        <?php
        if ($this->params->get('jquery') == 1):
            //$doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/jquery.js');
            ?>
            <script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/javascript/jquery.min.js"></script>
            <?php
        elseif ($this->params->get('jquery') == 2):
            //$doc->addScript('https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
            ?>
            <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <?php endif; ?>
        <jdoc:include type="head" />

        <!--<link rel="stylesheet" href="<?php #echo $this->baseurl   ?>/templates/system/css/system.css" type="text/css" />!-->
        <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/position.css" type="text/css" media="screen,projection" />
        <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/layout.css" type="text/css" media="screen,projection" />
        <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/print.css" type="text/css" media="print" />
        <?php if ($this->params->get('include_pretty')): ?>
            <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/prettyPhoto.css" type="text/css" media="screen,projection" />
        <?php endif; ?>
        <link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/bootstrap/<?php echo $bootstrap; ?>" rel="stylesheet" type="text/css" />
        <link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/bootstrap-responsive.css" rel="stylesheet" />
        <link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/expbootstrap/<?php echo $expbootstrap; ?>" rel="stylesheet" />
        <link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/expicons.css" rel="stylesheet" />

        <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
          <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <?php if ($this->params->get('jquery')): ?>
            <?php
            if ($this->params->get('bootstrap-transition'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-transition.js');
            if ($this->params->get('bootstrap-alert'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-alert.js');
            if ($this->params->get('bootstrap-dropdown'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-dropdown.js');
            if ($this->params->get('bootstrap-transition'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-transition.js');
            if ($this->params->get('bootstrap-tab'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-tab.js');
            if ($this->params->get('bootstrap-button'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-button.js');
            if ($this->params->get('bootstrap-collapse'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-collapse.js');
            if ($this->params->get('bootstrap-tooltip'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-tooltip.js');
            if ($this->params->get('bootstrap-popover'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-popover.js');
            if ($this->params->get('bootstrap-carousel'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-carousel.js');
            if ($this->params->get('bootstrap-modal'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-modal.js');
            if ($this->params->get('bootstrap-scrollspy'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-scrollspy.js');
            if ($this->params->get('bootstrap-typeahead'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-typeahead.js');
            if ($this->params->get('bootstrap-affix'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/bootstrap-affix.js');
            if ($this->params->get('include_pretty'))
                $doc->addScript($this->baseurl . '/templates/' . $this->template . '/javascript/jquery.prettyPhoto.js');

            //print_r($this->params->get('bootstrap-tooltip'));
            $js = "jQuery(function () {";
            $js .= "jQuery('.tab a:first').tab('show');";
            $js .= "jQuery(\"[rel^='tooltip'],.tooltip\").tooltip();";
            $js .= "jQuery(\"a[rel^='popover'],.popover\").popover();";
            if ($this->params->get('include_pretty')) {
                $js .= "jQuery(\"a[rel^='prettyPhoto'],.preety_photo\").prettyPhoto({
                    animation_speed:'" . $this->params->get('pretty_animation_speed') . "',
                    slideshow: " . $this->params->get('pretty_slideshow') . ",
                    autoplay_slideshow: " . $this->params->get('pretty_autoplay_slideshow') . ",
                    opacity: " . $this->params->get('pretty_opacity') . ",
                    show_title: " . $this->params->get('pretty_show_title') . ",
                    default_width: " . $this->params->get('pretty_default_width') . ",
                    default_height: " . $this->params->get('pretty_default_height') . ",
                    counter_separator_label: '" . $this->params->get('pretty_counter_separator_label') . "',
                    theme: '" . $this->params->get('pretty_theme') . "',
                    horizontal_padding: " . $this->params->get('pretty_horizontal_padding') . ",
                    hideflash: " . $this->params->get('pretty_hideflash') . ",
                    autoplay: " . $this->params->get('pretty_autoplay') . ",
                    modal: " . $this->params->get('pretty_modal') . ",
                    social_tools: '" . $this->params->get('pretty_social_tools') . "'
                    });";
            }
            $js .= "})";
            $doc->addScriptDeclaration($js);
            ?>
        <?php endif; ?>
        <style type="text/css">
            body {
                <?php if($this->direction == 'rtl'): ?>
                    direction: rtl;
                <?php endif; ?>
                <?php if($this->params->get('topnav')): ?>
                    padding-top: 60px;
                <?php endif; ?>
                padding-bottom: 0px;
            }
            .sidebar-nav {
                padding: 9px 0;
            }
        </style>
    </head>

    <body>
        <?php if ($this->params->get('exptemplicense')): ?>
            <div class="navbar <?php echo $expnavbar;?>  <?php echo $templateparams->get('topnav_class','') ?>" id="exptop_nav">
                <div class="navbar-inner">
                    <div class="container<?php echo $gsystem; ?>">
                        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </a>
                        <a class="brand" href="<?php echo $this->baseurl ?>">
                            <?php if ($logo): ?>
                                <img src="<?php echo $this->baseurl ?>/<?php echo htmlspecialchars($logo); ?>"  alt="<?php echo htmlspecialchars($templateparams->get('sitetitle')); ?>" />
                            <?php else: ?>
                                <?php echo htmlspecialchars($templateparams->get('sitetitle')); ?>
                            <?php endif; ?>
                        </a>
                        <div class="nav-collapse">
                            <jdoc:include type="modules" name="top-menu" />
                        </div>
                        <div class="nav pull-right">
                            <jdoc:include type="modules" name="search" />
                            <?php if ($this->countModules('top-right')): ?>
                                <li class="divider-vertical"></li>
                                <jdoc:include type="modules" name="top-right" />
                            <?php endif; ?>
                            <?php if ($this->countModules('language')): ?>
                                <li class="divider-vertical"></li>
                                <jdoc:include type="modules" name="language" />
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>

            <div id="exptemplates" class="container<?php echo $gsystem; ?>">
                <!-- Main hero unit for a primary marketing message or call to action -->
                <?php if ($this->countModules('hero-unit')): ?>
                    <div class="hero-unit">
                        <jdoc:include type="modules" name="hero-unit" />
                    </div>
                <?php endif; ?>

                <!-- Header Modules Positions -->
                <div class="row<?php echo $gsystem; ?> exptempheader">
                    <?php if ($this->countModules('header-a')): ?>
                        <div class="span<?php echo $span_header; ?>">
                            <jdoc:include type="modules" name="header-a" style="<?php echo $templateparams->get('pos_header-a'); ?>" />
                        </div>
                    <?php endif; ?>
                    <?php if ($this->countModules('header-b')): ?>
                        <div class="span<?php echo $span_header; ?>">
                            <jdoc:include type="modules" name="header-b" style="<?php echo $templateparams->get('pos_header-b'); ?>" />
                        </div>
                    <?php endif; ?>
                    <?php if ($this->countModules('header-c')): ?>
                        <div class="span<?php echo $span_header; ?>">
                            <jdoc:include type="modules" name="header-c" style="<?php echo $templateparams->get('pos_header-c'); ?>" />
                        </div>
                    <?php endif; ?>
                </div>
                <div class="row<?php echo $gsystem; ?> exptemp-middle-menu">
                    <div class="span12">
                        <jdoc:include type="modules" name="middle-menu" />
                    </div>
                </div>

                <!-- Breadcrumbs Position -->
                <?php if ($this->countModules('breadcrumbs')): ?>
                    <div class="row<?php echo $gsystem; ?> exptemp-breadcrumbs">
                        <div class="span12">
                            <jdoc:include type="modules" name="breadcrumbs" />
                        </div>
                    </div>
                <?php endif; ?>

                <!-- Middle Modules Positions -->
                <div class="row<?php echo $gsystem; ?> exptemp-middle">
                    <?php if ($this->countModules('middle-a')): ?>
                        <div class="span<?php echo $span_middle; ?>">
                            <jdoc:include type="modules" name="middle-a" style="<?php echo $templateparams->get('pos_middle-a'); ?>" />
                        </div>
                    <?php endif; ?>
                    <?php if ($this->countModules('middle-b')): ?>
                        <div class="span<?php echo $span_middle; ?>">
                            <jdoc:include type="modules" name="middle-b" style="<?php echo $templateparams->get('pos_middle-b'); ?>" />
                        </div>
                    <?php endif; ?>
                    <?php if ($this->countModules('middle-c')): ?>
                        <div class="span<?php echo $span_middle; ?>">
                            <jdoc:include type="modules" name="middle-c" style="<?php echo $templateparams->get('pos_middle-c'); ?>" />
                        </div>
                    <?php endif; ?>
                </div>
                <div class="row<?php echo $gsystem; ?>">
                    <div class="span<?php echo $left_span; ?> exptemp-left">
                        <jdoc:include type="modules" name="left" style="<?php echo $templateparams->get('pos_left'); ?>" />
                        <jdoc:include type="modules" name="left1" style="<?php echo $templateparams->get('pos_left-1'); ?>" />
                        <jdoc:include type="modules" name="left2" style="<?php echo $templateparams->get('pos_left-2'); ?>" />
                    </div><!--/span-->
                    <div class="span<?php echo $expcontent; ?>">

                        <div class="row<?php echo $gsystem; ?> exptemp-content">
                            <?php if ($this->countModules('content-a')): ?>
                                <div class="span<?php echo $span_content; ?>">
                                    <jdoc:include type="modules" name="content-a" style="<?php echo $templateparams->get('pos_content-a'); ?>" />
                                </div>
                            <?php endif; ?>
                            <?php if ($this->countModules('content-b')): ?>
                                <div class="span<?php echo $span_content; ?>">
                                    <jdoc:include type="modules" name="content-b" style="<?php echo $templateparams->get('pos_content-b'); ?>" />
                                </div>
                            <?php endif; ?>
                            <?php if ($this->countModules('content-c')): ?>
                                <div class="span<?php echo $span_content; ?>">
                                    <jdoc:include type="modules" name="content-c" style="<?php echo $templateparams->get('pos_content-c'); ?>" />
                                </div>
                            <?php endif; ?>
                        </div>
                        <?php if ($this->countModules('content-menu')): ?>       
                            <div class="row<?php echo $gsystem; ?> subnav exptemp-content-menu">
                                <div class="span<?php echo $expcontent; ?>">
                                    <jdoc:include type="modules" name="content-menu" />
                                </div>
                            </div>
                        <?php endif; ?>
                        <div class="exptemp-component <?php echo $expwell; ?>">
                            <jdoc:include type="message" />
                            <jdoc:include type="component" />
                        </div>
                        <div class="row<?php echo $gsystem; ?> exptemp-feature">
                            <?php if ($this->countModules('feature-a')): ?>
                                <div class="span<?php echo $span_feature; ?>">
                                    <jdoc:include type="modules" name="feature-a" style="<?php echo $templateparams->get('pos_feature-a'); ?>" />
                                </div>
                            <?php endif; ?>
                            <?php if ($this->countModules('feature-b')): ?>
                                <div class="span<?php echo $span_feature; ?>">
                                    <jdoc:include type="modules" name="feature-b" style="<?php echo $templateparams->get('pos_feature-b'); ?>" />
                                </div>
                            <?php endif; ?>
                            <?php if ($this->countModules('feature-c')): ?>
                                <div class="span<?php echo $span_feature; ?>">
                                    <jdoc:include type="modules" name="feature-c" style="<?php echo $templateparams->get('pos_feature-c'); ?>" />
                                </div>
                            <?php endif; ?>
                        </div>
                    </div><!--/span-->
                    <div class="span<?php echo $right_span; ?> exptemp-right">
                        <jdoc:include type="modules" name="right" style="<?php echo $templateparams->get('pos_right'); ?>" />
                    </div><!--/span-->
                </div><!--/row-->
            
                <!-- Bottom Modules Positions -->
                <div class="row<?php echo $gsystem; ?> exptemp-bottom">
                    <?php if ($this->countModules('bottom-a')): ?>
                        <div class="span<?php echo $span_bottom; ?>">
                            <jdoc:include type="modules" name="bottom-a" style="<?php echo $templateparams->get('pos_bottom-a'); ?>" />
                        </div>
                    <?php endif; ?>
                    <?php if ($this->countModules('bottom-b')): ?>
                        <div class="span<?php echo $span_bottom; ?>">
                            <jdoc:include type="modules" name="bottom-b" style="<?php echo $templateparams->get('pos_bottom-b'); ?>" />
                        </div>
                    <?php endif; ?>
                    <?php if ($this->countModules('bottom-c')): ?>
                        <div class="span<?php echo $span_bottom; ?>">
                            <jdoc:include type="modules" name="bottom-c" style="<?php echo $templateparams->get('pos_bottom-c'); ?>" />
                        </div>
                    <?php endif; ?>
                    <?php if ($this->countModules('bottom-d')): ?>
                        <div class="span<?php echo $span_bottom; ?>">
                            <jdoc:include type="modules" name="bottom-d" style="<?php echo $templateparams->get('pos_bottom-d'); ?>" />
                        </div>
                    <?php endif; ?>
                </div>

                <footer class="exptemplates_footer">
                    <div class="navbar <?php echo $templateparams->get('bottomnav_class','') ?>">
                        <div class="navbar-inner">
                            <div class="container<?php echo $gsystem; ?>">
                                <a class="brand expsize14" href="<?php echo $templateparams->get('logolink') ?>">
                                    <?php if ($footerlogo): ?>
                                        <img src="<?php echo $this->baseurl ?>/<?php echo htmlspecialchars($footerlogo); ?>"  alt="<?php echo htmlspecialchars($templateparams->get('sitetitle')); ?>" />
                                    <?php else: ?>
                                        <img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/images/logo_exp.png"  alt="<?php echo htmlspecialchars($templateparams->get('sitetitle')); ?>" />
                                    <?php endif; ?>
                                </a>
                                <div class="nav pull-right">
                                    <a id="footer_copy" class="brand expsize14" href="<?php echo $this->baseurl ?>">
                                            <?php echo htmlspecialchars($templateparams->get('sitetitle')); ?> &copy; Company 2012
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </footer>
                <jdoc:include type="modules" name="debug" />
            </div> <!-- /container -->
            <!--
            * This code cannot be deleted!
            * Removing this code will automatically lead to a breach of the license.
            * Read more here www.feellove.eu
            -->
            <div id="exptemplate_license" style="display:none;"><?php echo $this->params->get('exptemplicense'); ?></div>
            <!-- End License code -->
        <?php else: ?>
            <div id="exptemplates" class="container<?php echo $gsystem; ?>">
                <div class="hero-unit">
                    <div class="alert alert-error">
                        <?php echo JText::_('TPL_EXPTEMPLATE_FP_WARNING_TEXT'); ?>
                    </div>
                </div>
            </div>
        <?php endif; ?>
    </body>
</html>
